package cn.fl.repay.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.repay.dto.InsCstRepayLogDTO;
import cn.fl.repay.dto.InsCstRepaySettleDTO;
import cn.fl.repay.vo.InsCstRepayLogVO;
import cn.fl.repay.vo.InsCstRepaySettleVO;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class InsCstRepaySettleVOTransform {

    /**
     * DTO 转  VO
     * @param dto InsCstRepayLogDTO
     * @return InsCstRepayLogVO
     */
    public static InsCstRepaySettleVO toVO(InsCstRepaySettleDTO dto) {
        InsCstRepaySettleVO  vo = null;
        if (dto != null) {
            vo = new InsCstRepaySettleVO();
            BeanUtils.copyProperties(dto,vo);
        }
        return vo;
    }

    /**
     * VO 转 DTO
     * @param vo InsCstRepayLogVO
     * @return InsCstRepayLogDTO
     */
    public static InsCstRepaySettleDTO toDTO(InsCstRepaySettleVO vo) {
        InsCstRepaySettleDTO dto = null;
        if (vo != null) {
            dto = new InsCstRepaySettleDTO();
            BeanUtils.copyProperties(vo,dto);
        }
        return dto;
    }

    /**
     * DTO集合 转 VO集合
     * @param list List<InsCstRepayLog>
     * @return List<InsCstRepayLogDTO>
     */
    public static List<InsCstRepaySettleVO> toVOList(List<InsCstRepaySettleDTO> list) {
        List<InsCstRepaySettleVO>  voList = new ArrayList<InsCstRepaySettleVO>();
        if(CollectionUtils.isNotEmpty(list)){
            for (InsCstRepaySettleDTO dto : list) {
                voList.add(toVO(dto));
            }
        }
        return voList;
    }

}
